home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / prgtools / mint / mgr / sparcmgr / doc.zoo / doc / usrman / doc.5 < prev    next >
Encoding:
Text File  |  1989-01-24  |  9.7 KB  |  454 lines

  1. '\"                        Copyright (c) 1988 Bellcore
  2. '\"                            All Rights Reserved
  3. '\"       Permission is granted to copy or use this program, EXCEPT that it
  4. '\"       may not be sold for profit, the copyright notice must be reproduced
  5. '\"       on copies, and credit should be given to Bellcore where it is due.
  6. '\"       BELLCORE MAKES NO WARRANTY AND ACCEPTS NO LIABILITY FOR THIS PROGRAM.
  7. '\"
  8. '\"    $Header: doc.5,v 4.1 88/06/29 17:05:04 bianchi Exp $
  9. '\"    $Source: /tmp/mgrsrc/doc/usrman/RCS/doc.5,v $
  10. .Sh page Functions
  11. The functions listed below have packaged common sequences of
  12. .I macro
  13. calls together to provide a slightly higher level of interface than the
  14. macros alone.  They are still low level, and have no pretense of
  15. completeness. Except where noted, all of the functions return a value
  16. greater than zero on success, and a value less than zero upon failure.
  17. The functions fail only if they read an unexpected value from \*M.
  18. Client programs may use the function
  19. .Fr m_lastline
  20. in an attempt to determine what input caused the failure.
  21. Those functions which expect data from \*M automatically flush any
  22. pending output before reading, and unless the 
  23. .I M_MODEOK
  24. flag is set,
  25. attempt to turn off character echoing
  26. to prevent data returned by \*M from echoing back on the window.
  27. .LP
  28. .RS
  29. .Fd int
  30. .Fr get_all list 
  31. .Fs get_all\(dg 7 "Get all window status"
  32. .br
  33. struct window_data \*Alist;
  34. .Ft
  35. The current position size and status of all windows on the display
  36. is returned in
  37. .Fi list .
  38. The number of in
  39. windows on the display is returned.
  40. .Fi List
  41. should be large enough to hold a status entry for each window.
  42. The
  43. .I window_data
  44. structure 
  45. is defined in
  46. .I term.h .
  47. .Fd int
  48. .Fr get_client list 
  49. .Fs get_client\(dg 7 "Get alternate window status"
  50. .br
  51. struct window_data \*Alist;
  52. .Ft
  53. The current position size and status of the client programs
  54. .I main
  55. and
  56. .I alternate
  57. windows
  58. is returned in
  59. .Fi list .
  60. The number of
  61. windows owned by the client program is returned.
  62. .Fi List
  63. should be large enough to hold a status entry for each window.
  64. The
  65. .I window_data
  66. structure 
  67. is defined in
  68. .I term.h .
  69. .Fd int
  70. .Fr get_colrow columns rows 
  71. .Fs get_colrow\(dg 7 "Get window size, in columns and rows"
  72. .br
  73. int \*Acolumns, \*Arows;
  74. .Ft
  75. The number of
  76. .I columns
  77. and
  78. .I rows
  79. in the current 
  80. .I "text region"
  81. is returned in
  82. .Fi columns
  83. and
  84. .Fi rows
  85. respectively.
  86. For any
  87. .SM
  88. .I NULL
  89. .LG
  90. argument,
  91. no value is returned.
  92. .Fd int
  93. .Fr get_cursor column row 
  94. .Fs get_cursor\(dg 7 "Get cursor position"
  95. .br
  96. int \*Acolumn, \*Arow;
  97. .Ft
  98. The current
  99. .I character
  100. cursor position is placed in
  101. .Fi column
  102. and
  103. .Fi row .
  104. For any
  105. .SM
  106. .I NULL
  107. .LG
  108. argument,
  109. no value is returned.
  110. .Fd int
  111. .Fr get_eachclientwin windatap
  112. .Fs get_eachclientwin\(dg 7 "Get window parameters for each window"
  113. .br
  114. struct window_data \*Awindatap;
  115. .Ft
  116. Get the window parameters for each window in the current window set,
  117. one window at a time.
  118. This function returns 1 if window_data structure has been filled,
  119. 0 otherwise.
  120. It is important to call get_eachcleintwin() in a tight loop that
  121. doesn't exit until it returns 0,
  122. so that all the data is picked up.
  123. This function is preferred to
  124. .Fr get_client
  125.  because you don't need to know the maximum number of windows you are likely
  126. to see.
  127. .Fd int
  128. .Fr get_eachwin windatap
  129. .Fs get_eachwin\(dg 7 "Get window parameters for each window"
  130. .br
  131. struct window_data \*Awindatap;
  132. .Ft
  133. Get the window parameters for all the windows,
  134. one window at a time.
  135. This function returns 1 if window_data structure has been filled,
  136. 0 otherwise.
  137. It is important to call get_eachwin() in a tight loop that
  138. doesn't exit until it returns 0,
  139. so that all the data is picked up.
  140. This function is preferred to
  141. .Fr get_all
  142.  because you don't need to know the maximum number of windows you are likely
  143. to see.
  144. .Fd int
  145. .Fr get_font wide high 
  146. .Fs get_font\(dg 7 "Get character font size"
  147. .br
  148. int  \*Awide, \*Ahigh;
  149. .Ft
  150. The character size of the current font, in pixels
  151. is placed in
  152. .Fi wide
  153. and
  154. .Fi high .
  155. For any
  156. .SM
  157. .I NULL
  158. .LG
  159. argument,
  160. no value is returned.
  161. The function returns the current font number, as would be
  162. used in a call to
  163. .Fr m_font
  164. \&.
  165. .Fd int
  166. .Fr get_mouse x y 
  167. .Fs get_mouse\(dg 7 "Get mouse position"
  168. .br
  169. int \*Ax, \*Ay;
  170. .Ft
  171. The current mouse
  172. position, in
  173. .I window
  174. coordinates, is placed in
  175. .Fi x
  176. and
  177. .Fi y .
  178. For any
  179. .SM
  180. .I NULL
  181. .LG
  182. argument,
  183. no value is returned.
  184. The function returns the current mouse button state, which is
  185. in the range of -2 to +2 upon success, a value less than -2
  186. upon failure.
  187. See 
  188. .Fr m_getinfo G_MOUSE
  189.  for a discussion of the return values.
  190. .Fd int
  191. .Fr get_param host xmax ymax border 
  192. .Fs get_param\(dg 7 "Get \*M system parameters"
  193. .br
  194. char \*Ahost;
  195. int \*Axmax, \*Aymax, \*Aborder;
  196. .Ft
  197. The
  198. .I \*M-host ,
  199. display size (in pixels)
  200. and window border size (in pixels) is placed in the arguments
  201. .Fi host , xmax , ymax ,
  202. and
  203. .Fi border .
  204. For any
  205. .SM
  206. .I NULL
  207. .LG
  208. argument,
  209. no value is returned.
  210. .Fd int
  211. .Fr get_size X Y Dwidth Dheight 
  212. .Fs get_size\(dg 7 "Get the window size and position on the display"
  213. .br
  214. int \*AX, \*AY, \*ADwidth, \*ADheight;
  215. .Ft
  216. The position of the window on the display, in
  217. .I display
  218. coordinates is placed into
  219. .Fi X , Y , Dwidth 
  220. and
  221. .Fi Dheight .
  222. For any
  223. .SM
  224. .I NULL
  225. .LG
  226. argument,
  227. no value is returned.
  228. .Fd char \*A
  229. .Fr get_termcap  
  230. .Fs get_termcap\(dg 7 "Get a \s-2TERMCAP\s+2 entry"
  231. .br
  232. .Ft
  233. A string containing a
  234. .I \s-2TERMCAP\s+2
  235. entry, suitable for placing into the
  236. .I \s-2TERMCAP\s+2
  237. environment variable is returned.
  238. The function
  239. .Fr get_termcap
  240.  returns 
  241. .SM
  242. .I NULL
  243. .LG
  244. upon failure.
  245. .Fd int
  246. .Fs is_active\(dg 7 "See if the window is the active window"
  247. .Fr is_active  
  248. .Ft
  249. .br
  250. The function
  251. .Fr is_active
  252.  returns
  253. .SM
  254. .I TRUE
  255. .LG
  256. if the window is the
  257. .I active
  258. window .
  259. .Fd void
  260. .Fr menu_load n count text 
  261. .Fs menu_load\(dg 8 "Down load a pop-up menu"
  262. .br
  263. int n;
  264. int count;
  265. struct menu_entry \*Atext;
  266. .Ft
  267. A menu is downloaded to \*M at position
  268. .Fi n .
  269. The integer 
  270. .Fi count
  271. is the number of menu items to be down-loaded, and
  272. .Fi text
  273. is an array of menu item/value pairs.
  274. The structure
  275. .I menu_entry
  276. is defined in
  277. .I term.h .
  278. .Fd int
  279. .Fr m_bitfile to name widep highp
  280. .Fs m_bitfile\(dg 5 "Read a bitmap file into a scratchpad bitmap"
  281. .br
  282. int to;
  283. char *name;
  284. int *widep, *highp;
  285. .Ft
  286. Given a bitmap id,
  287. .Fi to
  288. and an icon 
  289. .Fi name ,
  290. have \*M load that icon into that scratchpad bitmap,
  291. returning the icon width
  292. and height, in pixels, via the given integer pointers.
  293. Return a positive number if successful.
  294. If the icon is not loaded, set the width and height values to 0 and
  295. return 0.
  296. This function is identical to
  297. .Fr m_bitfromfile
  298. plus the needed interception of the line returned from \*M.
  299. .Fd void
  300. .Fr m_bitload x y wide high data 
  301. .Fs m_bitload\(dg 5 "Download an image into the window"
  302. .br
  303. int x,y;
  304. int wide,high;
  305. register char \*Adata;
  306. .Ft
  307. The bitmap image pointed at by
  308. .Fi data
  309. is down-loaded to the window
  310. at position
  311. .Fr ""  x  y
  312.  in 
  313. .I window
  314. coordinates.
  315. It is up to the client program to insure an 8 bit channel exists
  316. between the client and \*M.
  317. The integers
  318. .Fi wide
  319. and
  320. .Fi high
  321. specify the size of the bitmap in pixels.
  322. .Fd char \*A
  323. .Fr m_lastline  
  324. .Fs m_lastline\(dg 1 "Retrieve the last line send from \*M for a library function"
  325. .br
  326. .Ft
  327. The last input from \*M to a library function is returned.
  328. The data is kept in a static buffer which is overwritten
  329. at each request.
  330. .Fd int
  331. .Fr m_makewindow X Y Dwidth Dheight
  332. .Fs m_makewindow\(dg 11 "Make an alternate window"
  333. .br
  334. int  X, Y, Dwidth, Dheight;
  335. .Ft
  336. An alternate window is created as the
  337. .I active
  338. window,
  339. at display coordinates
  340. .Fr "" X Y
  341.  and of size
  342. .Fi Dwidth
  343. by
  344. .Fi Dheight
  345. pixels.
  346. If the window is too big to fit on the display, its
  347. width and height are truncated.
  348. The alternate window's
  349. .I window-id
  350. is returned if the window was created successfully.
  351. The macro
  352. .Fr m_selectwin
  353.  is used to write on the newly created window.
  354. .Fd int
  355. .Fr m_setup mode 
  356. .Fs m_setup\(dg 1 "Initialize the library package"
  357. .br
  358. int mode;
  359. .Ft
  360. This function initializes the library.
  361. It must be called before any other function or macro.
  362. The argument
  363. .Fi mode
  364. is one or more of the flags
  365. .SM
  366. .I M_FLUSH ,
  367. .I M_DEBUG ,
  368. .LG
  369. or
  370. .SM
  371. .I M_MODEOK
  372. .LG
  373. .I or -ed
  374. together.
  375. If 
  376. .SM
  377. .I M_FLUSH
  378. .LG
  379. is present, all macros and function flush output to \*M after each
  380. macro call.  This is slightly less efficient than letting the client
  381. program flush the data
  382. (see
  383. .Fr m_flush
  384.  )
  385. but prevent inadvertent buffering problems.
  386. The 
  387. .I M_DEBUG
  388. flag forces the macro package to read and write from
  389. .I stdin
  390. and
  391. .I stdout
  392. respectively.
  393. Normally
  394. .I /dev/tty
  395. is opened for reading and writing to permit standard input or output
  396. redirection while still maintaining a connection to \*M.
  397. If
  398. .I /dev/tty
  399. can not be opened, as would be the case for clients invoked through
  400. .I rsh ,
  401. the
  402. .I M_DEBUG
  403. flag is turned on,
  404. and
  405. .I stdin
  406. and
  407. .I stdout
  408. are used instead.
  409. The
  410. .I M_MODEOK
  411. flag instructs those functions which expect data from \*M
  412. to assume the terminal modes are set appropriately.
  413. Otherwise, the functions attempt to turn off character echoing and
  414. turn on line mode before fetching data from \*M.
  415. The functions
  416. .Fr m_ttyset
  417.  and
  418. .Fr m_ttyreset
  419.  can be used to set and reset the terminal modes.
  420. The function
  421. .Fr m_setup
  422.  returns its argument, with the 
  423. .I M_DEBUG
  424. flag
  425. .I or -ed
  426. in if 
  427. .I /dev/tty
  428. can not be opened.
  429. .Fd void
  430. .Fr m_ttyreset  
  431. .Fs m_ttyreset\(dg 1 "Reset the tty modes"
  432. .br
  433. .Ft
  434. The terminal modes are restored to their state just
  435. prior to the last call to 
  436. .Fr m_ttyset 
  437. \&.
  438. Calls to 
  439. .Fr m_ttyset
  440.  and
  441. .Fr m_ttyreset
  442.  may be stacked up to ten levels.
  443. .Fd int
  444. .Fr m_ttyset  
  445. .Fs m_ttyset\(dg 1 "Set the tty modes for proper \*M interaction"
  446. .br
  447. .Ft
  448. The terminal is set in a state suitable for data exchange with \*M.
  449. Character echoing is turned off, and line processing mode
  450. is enabled.
  451. The function returns zero (0) if it successfully retrieves the terminal
  452. modes, -1 otherwise.
  453. .RE
  454.